<?php

class Extension extends QXC
{
    protected $QXC = null;
    protected $PATH = null;
    private static $extPath;

    function __construct()
    {
        $this->QXC = QXC();
        $this->PATH = self::$extPath;
    }

    public static function SetPath($path)
    {
        self::$extPath = $path;
    }

    public static function Load($name)
    {
        $extDir = CORE_DIR . '/system/' . strtolower($name);
        $extPath = $extDir . '/index.php';

        if (file_exists($extPath))
        {
            include_once ($extPath);
            
            self::$extPath = $extDir;

            $qName = "Q{$name}";          

            return new $qName();
        }
        else
        {
            return false;
        }
    }
}